home *** CD-ROM | disk | FTP | other *** search
- Path: futures.wharton.upenn.edu!ryan05
- From: ryan05@futures.wharton.upenn.edu (Arthur Ryan)
- Newsgroups: comp.lang.c++
- Subject: Array Assistance
- Date: 16 Jan 1996 21:20:43 GMT
- Organization: University of Pennsylvania
- Message-ID: <4dh4rb$ekq@netnews.upenn.edu>
- NNTP-Posting-Host: futures.wharton.upenn.edu
- X-Newsreader: TIN [version 1.2 PL2-upenn1.1]
-
- Background:-
- I am in the process of eaching myself some C++ (Microsoft Version 1.5).
- I am having trouble manipulating an array of integers.
-
- Objective:-
- I want to read a "CSV" file from disk in to an integer array. Thereafter
- to perform operations upon the values, currently just trying to display
- the output to verify the correct reading into the array.
-
- Problem:-
- Execution results in the programme continuously looping/running and not
- responding (the only indication of performance is the drive activating to
- open the file for a few seconds). When I force the programme to shut down
- the message box "Process OX" followed by characters and numbers (each
- different at every running of the programme) i.e OXC37 or OXCA7. Additionally
- the 'OUTPUT' screen displays the line 'Loaded symbols for I:\APPS\WCITPRNT
- \CSTEXT.VBX'. I have produced the relevant section of code below, the
- remainder merely being a menu and some branching. The size of the array
- to read is 774 rows by 29 columns of positive numerics of differing lenght.
-
- Let me know your thoughts. Thanks in advance.
-
-
-
-
-
-
-
- #include <iostream.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <fstream.h>
- #include <io.h>
-
- int oda[773][28];
-
- main()
- {
- menu display and branching based upon responese etc...
- }
-
-
- data_in()
- {
- int i,j;
-
- ifstream fsin;
- fsin.open("A:\n&n\test.csv",ios::in);
-
- if(fsin.bad())
- {
- cout << "\n*** Serious I/O error ***\n";
- exit(0);
- }
-
- while (!fsin.eof())
- {
- for (i=0;i<774;i++);
- {
- for(j=0;j<29;j++)
- {
- fsin >> oda [i][j];
- }
- }
- }
-
- fsin.close();
-
- for (i=0;i<=774;i++)
- {
- for (j=0;j<=29;j++)
- {
- cout << oda [i][j];
- }
- cout << endl;
- }
-
- return(0);
- }
-
-